// ColorManager.cpp : implementation file
//

#include "stdafx.h"
#include "ColorManager.h"

// CColorManager

CColorManager::CColorManager(CxImage* pImage)
{
	this->m_pImage = pImage;
}

CColorManager::~CColorManager()
{
}


// CColorManager member functions

void CColorManager::SetImage(CxImage* pImage)
{
	this->m_pImage = pImage;
}

CxImage* CColorManager::GetImage()
{
	return this->m_pImage;
}

BOOL CColorManager::IsFullColor(RGBQUAD value)
{
	if (m_pImage->ResetIteration())
	{
		RGBQUAD color;
		while (m_pImage->GetNextPixelColor(color))
		{
			if (value.rgbRed != color.rgbRed ||
				value.rgbGreen != color.rgbGreen ||
				value.rgbBlue != color.rgbBlue)
				return FALSE;
		}
		return TRUE;
	}
	return FALSE;
}

BOOL CColorManager::IsFullBlack()
{
	RGBQUAD black;
	black.rgbRed = black.rgbGreen = black.rgbBlue = 0;
	return IsFullColor(black);
}

BOOL CColorManager::IsFullWhite()
{
	RGBQUAD white;
	white.rgbRed = white.rgbGreen = white.rgbBlue = 255;
	return IsFullColor(white);
}